package com.qfedu.exception;

import com.qfedu.common.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(CustomerException.class)
    public R customerHandler(CustomerException e){
        e.printStackTrace();
        return R.fail(e.getCode(),e.getMsg());
    }

    @ExceptionHandler(Exception.class)
    public R customerHandler(Exception e){
        e.printStackTrace();
        return R.fail("未知异常");
    }
}
